{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#programming_fever\n",
    "# Python program to create RGB color palette with trackbars    \n",
    "import cv2 \n",
    "import numpy as np \n",
    "\n",
    "def emptyFunction(): \n",
    "    pass\n",
    "   \n",
    "def main(): \n",
    "    image = np.zeros((512, 512, 3), np.uint8) \n",
    "    windowName =\"Open CV Color Palette\"\n",
    "    cv2.namedWindow(windowName)  \n",
    "       \n",
    "    cv2.createTrackbar('Blue', windowName, 0, 255, emptyFunction) \n",
    "    cv2.createTrackbar('Green', windowName, 0, 255, emptyFunction) \n",
    "    cv2.createTrackbar('Red', windowName, 0, 255, emptyFunction) \n",
    "       \n",
    "    while(True): \n",
    "        cv2.imshow(windowName, image) \n",
    "          \n",
    "        if cv2.waitKey(1) == 27: \n",
    "            break\n",
    "        \n",
    "        blue = cv2.getTrackbarPos('Blue', windowName) \n",
    "        green = cv2.getTrackbarPos('Green', windowName) \n",
    "        red = cv2.getTrackbarPos('Red', windowName) \n",
    "         \n",
    "        image[:] = [blue, green, red] \n",
    "        print(blue, green, red) \n",
    "           \n",
    "    cv2.destroyAllWindows() \n",
    "         \n",
    "if __name__==\"__main__\": \n",
    "    main() "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
